---
category: DOM
contributors:
    - iamdileepkumar
    - islamozbek
created: '2020-04-19'
title: Hide an element
updated: '2021-10-13'
---

**JavaScript version**

```js hide.js
// Pick the method that is suitable for your use case
const hide = (ele) => (ele.style.display = 'none');

// Or
const hide = (ele) => (ele.style.visibility = 'hidden');

// Or
const hide = (ele) => (ele.hidden = true);
```

**TypeScript version**

```ts hide.ts
const hide = (ele: HTMLElement): string => (ele.style.display = 'none');

// Or
const hide = (ele: HTMLElement): string => (ele.style.visibility = 'hidden');

// Or
const hide = (ele: HTMLElement): boolean => (ele.hidden = true);
```
